﻿@using OBUCare.Web.Infrastructure;
@using OBUCare.Core.Models;
@using OBUCare.Core.BL
@using OBUCare.Core.DataAccess;
@{
    ViewBag.Title = "StockInPrint";
    Layout = "";
}
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />

<div id="divPrint">

    <h2 style="text-align: center; height: 100px;">电子标签元器件入库登记单</h2>
    <div>

        <div style="height: 30px;">
            元器件：<span id="lblPartType">@ViewBag.parts</span>
        </div>
        <div>
            <div>



                @(Html.Telerik().Grid<View_PartsStockDetails>()
        .Name("Grid")
        .DataKeys(keys => keys.Add(c => c.ID))
        .DataBinding(dataBinding => dataBinding
            .Ajax()
            .Select("ListStockInDetails", "Parts",new {id=ViewBag.IDs})
                    )
        .Columns(columns =>
        {
            columns.Bound(o => o.ID)
                .ClientTemplate("<#= ++index #>").Title("序号").Width("8%");
            columns.Bound(o => o.SUPPLIER_NAME).Width("15%");
            columns.Bound(o => o.SPEC_NAME).Width("15%");
            columns.Bound(o => o.RECORD_DATE).Format("{0:yyyy-MM-dd}").Width("10%");
            columns.Bound(o => o.OPERATOR_NAME).Width("8%");
            columns.Bound(o => o.PARTS_COUNT).Width("8%");
        })
        .Footer(false)
        .TableHtmlAttributes(new { @style = "width:100%" })
                .ClientEvents(events =>
                {
                    events.OnError("onError");
                    events.OnDataBinding("onDataBinding");
                })                
        )
            </div>
        </div>
        <div style="text-align: right;height:30px;">
            <div style="height:14px;"></div>
            库房：速通公司
            <span style="width:100px;">&nbsp;</span>        
        </div>
        <div>
            <input type="hidden" id="hidIDs" />
        </div>
    </div>

</div>

<div style="text-align: right;" id="noPrint">
    <p>
        <input type="button" onclick="myPrint();" value="打印" />
        <input type="button" onclick="CloseWindow();" value="关闭" />
    </p>
</div>

<script type="text/javascript">
    function onError(e) {
        //debugger;
        e.preventDefault();
        /*if (e.XMLHttpRequest.status == "505")
        alert("系统字段不允许删除");
        else if (e.XMLHttpRequest.status == "506")
        alert("系统表不允许删除");
        else*/
        alert(e.XMLHttpRequest.getResponseHeader("message"));
    }

    var index = 0;

    function onDataBinding(e) {
        /*var grid = $('#Grid').data('tGrid')
        index = (grid.currentPage - 1) * grid.pageSize;
        var ids = $('#hidIDs').val();
        if (ids.StringIsNullOrEmpty())
            e.preventDefault();
        else {
            e.data = {
                // the key ("category") specifies the variable name of the action method which will contain the specified value
                id: ids
            };
        }*/
    }



    function myPrint() {

        $("#noPrint").css("display","none");
        window.print();
        $("#noPrint").css("display", "");
    }

    //function closeWin()
    //{
    //    debugger;
    //    var window = $("#Window").data("tWindow");        
    //    window.close();
    //}
</script>

@Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/Common")
    @(Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.simple.css").Combined(true).Compress(true)))
    @(Html.Telerik().ScriptRegistrar().Globalization(true).DefaultGroup(group => group.Combined(true).Compress(true)))





